//! Copyright 2012 Xicut Technology, Inc.
//! All rights reserved
//!
#ifndef __HostCmd_h__
#define __HostCmd_h__

#include "BasicTypes.h"

class cHostCmd
{
    static const U8 ID_INDEX = 1;
    static const U8 CMD_INDEX = 3;
    static const U8 DATA_INDEX = 4;

    static const U8 DEFAULT_ID_HIGH = '0';
    static const U8 DEFAULT_ID_LOW = '1';

    typedef enum
    {
        CREATE_USER_CMD     = 'S',
        ERASE_USER_CMD      = 'E',
        ERASE_ALL_USER_CMD  = 'L',
        CHECK_USER_CMD      = 'C',
        READ_TOTAL_USER_CMD = 'T',
        TIME_LED_OFF_CMD    = 'I',
        SET_COUNTER_CMD     = 'U',
        READ_COUNTER_CMD    = 'Y',
        GET_TIME_CMD        = 'G',
        SET_TIME_CMD        = 'H',
        GET_TIME_POINT_CMD  = 'O',
        SET_TIME_POINT_CMD  = 'P',
        TEST_REGISTER_USER_CMD  = 'w',
    } HOST_CMD;

private:
    static U8 GenerateReply(U8 *pData, U8 iRpl, U8 iErrCode);
    static U8 GenerateReply(U8 *pData, U8 iRpl, U8 iErrCode, U8 *pDataRpl,  U8 iDataRplLength);

public:
    static void InitReset();

    static U16  CmdProcessor(U8 *pData, U16 iLen);
};

#endif // __HostCmd_h__

